#include <iostream>
#include <string>
using namespace std;

int main(){
	int n;
	cin >> n;
	char s;
	for(int i = 0;i < n;i++){
		string s0;
		int x,y;
		cin >> s0;
		if(s0 == "a"||s0 == "b"||s0 == "c"){
			s = s0[0];
			cin >> x >> y;
		}
		else{
			x = stoi(s0);
			cin >> y;
		}
		if(s == 'a'){
			string as = to_string(x) + "+" + to_string(y) + "=" + to_string(x+y);
			cout << as << endl;
			cout << as.size() << endl; 
		}
		else if(s == 'b'){
			string as = to_string(x) + "-" + to_string(y) + "=" + to_string(x-y);
			cout << as << endl;
			cout << as.size() << endl; 
		}
		else if(s == 'c'){
			string as = to_string(x) + "*" + to_string(y) + "=" + to_string(x*y);
			cout << as << endl;
			cout << as.size() << endl; 
		}
	}
	return 0;
}
